﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Login.aspx.cs" Inherits="cn_Login" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>会员登录，<%=(new Web.Old_App_Code.BasicSet()).TitleBind() %></title>
    <meta name="Keywords" content="<%=(new Web.Old_App_Code.BasicSet()).KeywordBind() %>" />
    <meta name="Description" content="<%=(new Web.Old_App_Code.BasicSet()).DescriptionBind() %>" />

    <script type="text/javascript" src="<%=(new Web.Old_App_Code.TemplateLoad()).TemplateCssLoad() %>js/jquery-1.6.2.min.js"></script>

    <link href="<%=(new Web.Old_App_Code.TemplateLoad()).TemplateCssLoad() %>css/public.css" type="text/css" rel="stylesheet" />
    <link href="<%=(new Web.Old_App_Code.TemplateLoad()).TemplateCssLoad() %>css/member.css" type="text/css" rel="stylesheet" />
    
     <link href="<%=(new Web.Old_App_Code.TemplateLoad()).TemplateCssLoad() %>art_dialog/skins/idialog.css" rel="stylesheet" />

    <script type="text/javascript" src="<%=(new Web.Old_App_Code.TemplateLoad()).TemplateCssLoad() %>art_dialog/artDialog.js"></script>

    <script type="text/javascript" src="<%=(new Web.Old_App_Code.TemplateLoad()).TemplateCssLoad() %>art_dialog/plugins/iframeTools.source.js"></script>

    <script type="text/javascript" src="<%=(new Web.Old_App_Code.TemplateLoad()).TemplateCssLoad() %>js/art_dialog.js"></script>
    
</head>

<script language="javascript" type="text/javascript">
    $(function () {
        $("#txtUserName").blur(function () {
            if ($("#txtUserName").val() == "") {
                $("#spUserName").html("<img src=\"<%=(new Web.Old_App_Code.TemplateLoad()).TemplateCssLoad() %>images/wrong.gif\" />请输入用户名！");
            }
            else $("#spUserName").html("<img src=\"<%=(new Web.Old_App_Code.TemplateLoad()).TemplateCssLoad() %>images/right.gif\"/>");
            return false;
        });
        $("#txtUserPwd").blur(function () {
            if ($("#txtUserPwd").val() == "") {
                $("#spPwd").html("<img src=\"<%=(new Web.Old_App_Code.TemplateLoad()).TemplateCssLoad() %>images/wrong.gif\" />请输入密码！");
            } else $("#spPwd").html("<img src=\"<%=(new Web.Old_App_Code.TemplateLoad()).TemplateCssLoad() %>images/right.gif\"/>");
            return false;
        });
        $("#txtCode").blur(function () {
            if ($("#txtCode").val() == "") {
                $("#spCode").html("<img src=\"<%=(new Web.Old_App_Code.TemplateLoad()).TemplateCssLoad() %>images/wrong.gif\" />请输入验证码！");
            } else $("#spCode").html("<img src=\"<%=(new Web.Old_App_Code.TemplateLoad()).TemplateCssLoad() %>images/right.gif\"/>");
            return false;
        });
        $("#btnLogoinSubmit").click(function () {
            ///用户名
            if ($("#txtUserName").val() == "") {
                $("#txtUserName").select();
                $("#spUserName").html("<img src=\"<%=(new Web.Old_App_Code.TemplateLoad()).TemplateCssLoad() %>images/wrong.gif\" />请输入用户名！");
                return false;
            }
            else $("#spUserName").html("<img src=\"<%=(new Web.Old_App_Code.TemplateLoad()).TemplateCssLoad() %>images/right.gif\"/>");
            ///用户密码
            if ($("#txtUserPwd").val() == "") {
                $("#txtUserPwd").select();
                $("#spPwd").html("<img src=\"<%=(new Web.Old_App_Code.TemplateLoad()).TemplateCssLoad() %>images/wrong.gif\" />请输入密码！");
                return false;
            } else $("#spPwd").html("<img src=\"<%=(new Web.Old_App_Code.TemplateLoad()).TemplateCssLoad() %>images/right.gif\"/>");
            ///验证码
            if ($("#txtCode").val() == "") {
                $("#txtCode").select();
                $("#spCode").html("<img src=\"<%=(new Web.Old_App_Code.TemplateLoad()).TemplateCssLoad() %>images/wrong.gif\" />请输入验证码！");
                return false;
            } else $("#spCode").html("<img src=\"<%=(new Web.Old_App_Code.TemplateLoad()).TemplateCssLoad() %>images/right.gif\"/>");
            $.ajax({
                type: "POST",
                url: "login.ashx",
                data: "userName=" + escape($("#txtUserName").val()) + "&userPwd=" + escape($("#txtUserPwd").val()) + "&code=" + escape($("#txtCode").val()),
                success: function (msg) {
                    if (msg == "0") {
                        $("#txtCode").select();
                        $("#spCode").html("<img src=\"<%=(new Web.Old_App_Code.TemplateLoad()).TemplateCssLoad() %>images/wrong.gif\" />验证码错误！");
                        $("#spUserName").html("<img src=\"<%=(new Web.Old_App_Code.TemplateLoad()).TemplateCssLoad() %>images/right.gif\"/>");
                        $("#imgCheckCode").attr("src", "/code.aspx?a=" + Math.random() + "&t=memberLogin");
                    }
                    else if (msg == "1") {
                        $("#txtUserName").select();
                        $("#spUserName").html("<img src=\"<%=(new Web.Old_App_Code.TemplateLoad()).TemplateCssLoad() %>images/wrong.gif\" />用户名不存在！");
                        $("#spCode").html("<img src=\"<%=(new Web.Old_App_Code.TemplateLoad()).TemplateCssLoad() %>images/right.gif\"/>");
                    }
                    else if (msg == "2") {
                        $("#txtUserPwd").select();
                        $("#spPwd").html("<img src=\"<%=(new Web.Old_App_Code.TemplateLoad()).TemplateCssLoad() %>images/wrong.gif\" />用户密码错误！");
                        $("#spUserName").html("<img src=\"<%=(new Web.Old_App_Code.TemplateLoad()).TemplateCssLoad() %>images/right.gif\"/>");
                        $("#spCode").html("<img src=\"<%=(new Web.Old_App_Code.TemplateLoad()).TemplateCssLoad() %>images/right.gif\"/>");
                    }
                    else if (msg == "3") {
                        $("#txtUserName").select();
                        $("#spUserName").html("<img src=\"<%=(new Web.Old_App_Code.TemplateLoad()).TemplateCssLoad() %>images/wrong.gif\" />该用户被停用！");
                        $("#spPwd").html("<img src=\"<%=(new Web.Old_App_Code.TemplateLoad()).TemplateCssLoad() %>images/right.gif\"/>");
                        $("#spCode").html("<img src=\"<%=(new Web.Old_App_Code.TemplateLoad()).TemplateCssLoad() %>images/right.gif\"/>");
                    }
                    else {
                        art.dialog.tips("恭喜您，登录成功！", 1.5);
                        if (parent.location.href.substring(parent.location.href.lastIndexOf("/") + 1) == "shopping_cart.html" || parent.location.href.substring(parent.location.href.lastIndexOf("/") + 1) == "group_buy_shopping_cart.html") {
                            setTimeout("parent.location.reload()", 2000);
                        }
                        else {
                            parent.$("#puser").html(msg);
                            setTimeout("parent.TB_remove()", 2000);
                        }
                    }
                }
            });
            return false;
        });
        $("#btnMemberRegister").click(function () {
            window.location.href = "register.html?TB_iframe=true&height=370&width=640";
        });
    });
</script>

<body class="login">
    <div id="login">
        <h2>
            <strong>用户登录</strong></h2>
        <form id="formLogin" action="login.ashx" defaultbutton="btnLogoinSubmit">
            <p>
                <label for="txtUserName">
                    用户名</label><input id="txtUserName" type="text" /><span id="spUserName">*</span></p>
            <p>
                <label for="txtUserPwd">
                    用户密码</label><input id="txtUserPwd" type="password" /><span id="spPwd">*</span></p>
            <p>
                <label for="txtCode">
                    验证码</label><input id="txtCode" type="text" maxlength="4" class="txtCode" autocomplete="off" /><img id="imgCheckCode"
                        src="/code.aspx?t=memberLogin" alt="看不清楚,换一张" onclick="this.src = '/code.aspx?a=' + Math.random();+'&t=memberLogin'"
                        class="imgCode" /><span id="spCode">*</span>
            </p>
            <p>
                <input id="btnLogoinSubmit" class="submit" type="submit" value="确认提交" />
                <input id="btnMemberRegister" class="button" type="button" value="会员注册" />
                <a href="#">忘记了密码？点击找回！</a></p>
        </form>
        <iframe class="ifhideselect" frameborder="0"></iframe>
    </div>
</body>
</html>
